//
//  SWEventDetailFetchReq.swift
//  ChildStory
//
//  Created by linhan on 2016/11/14.
//  Copyright © 2016年 Aiya. All rights reserved.
//

import Foundation

class SWEventDetailFetchReq: SWBaseRequest
{
    var eventID:String = ""
    
    override init()
    {
        super.init()
        api = SWRequestAPI.EventDetailFetch
    }
    
    override var params:Any?
    {
        return ["caseId":eventID]
    }
    
    override func JSONToModel(_ json:JSON, JSONString:String, JSONData:Data) -> AnyObject?
    {
        //trace(json)
        return Mapper<SWEventDetailFetchRsp>().map(JSONString: JSONString)
    }
    
    override func load()
    {
        DispatchQueue.global(qos: .default).async {
            if let url = Bundle.main.url(forResource: "event_detail_00003", withExtension: "json"),
                let data = try? Data(contentsOf: url)
            {
                self.didFinishLoading(data, cache: true)
            }
        }
    }
}

class SWEventDetailFetchRsp: NSObject,Mappable
{
    var code:String?
    var event:SWEventRsp?
    
    required init?(map: Map) { }
    
    // Mappable
    func mapping(map: Map) {
        code      <- map["Status"]
        event     <- map["BaseModle"]
    }
}


